home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
chapte21
/
ex2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-10-29
|
2KB
|
43 lines
#include <genstub.c>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST:
{
LPTSTR lpTemp;
char szCommandLine[MAX_PATH + 1];
char szBuffer[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwcNameSize = MAX_COMPUTERNAME_LENGTH + 1;
// Report computer name.
GetComputerName( szBuffer, &dwcNameSize );
MessageBox( hWnd, szBuffer, "Computer Name", MB_OK );
// Parse first token from command line.
lstrcpy( szCommandLine, GetCommandLine() );
lpTemp = strstr( szCommandLine, " " );
if ( lpTemp )
lpTemp = strtok( lpTemp, " " );
if ( lpTemp )
SetComputerName( lpTemp );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return (DefWindowProc(hWnd, uMsg, wParam, lParam));
}
return (NULL);
}